package stud.mpgame.old.game;

import org.apache.mina.core.session.IoSession;
import stud.mpgame.snapshot.ICommand;
import stud.mpgame.snapshot.ISnapshot;

/**
 * @author f.pavel91@gmail.com
 * @version 1.0
 */
public class PlayerRemoveCommand implements ICommand {

    private int time;
    private IoSession session;

    public PlayerRemoveCommand(int time, IoSession session) {
        this.time = time;
        this.session = session;
    }

    public int getTime() {
        return time;
    }

    public IoSession getSession() {
        return session;
    }

    public int getUserID() {
        return (Integer)session.getAttribute("userID");
    }

    public void apply(ISnapshot snapshot) {
        ((GameWorld) snapshot).removeUser(session);
    }

}
